{
 "metadata": {
  "name": "",
  "signature": "sha256:63a18892b0d8b4acd275468ad5a36f0acc1d927d291bca1ed8d94ddb5e023acb"
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "%pylab "
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Using matplotlib backend: TkAgg\n",
        "Populating the interactive namespace from numpy and matplotlib\n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from mpl_toolkits.mplot3d import axes3d\n",
      "import matplotlib.pyplot as plt\n",
      "import numpy as np\n",
      "def fn(x,y,z):\n",
      "    return ((x**2) + 9*(y**2)/4 + (z**2) - 1)**3-(x**2)*(z**3)-9*(y**2)*(z**3)/80\n",
      "bbox=(-1.2,1.2)\n",
      "xmin, xmax, ymin, ymax, zmin, zmax = bbox*3\n",
      "fig = plt.figure()\n",
      "ax = fig.add_subplot(111, projection='3d')\n",
      "A = np.linspace(xmin, xmax, 100)\n",
      "B = np.linspace(xmin, xmax, 50)\n",
      "A1,A2 = np.meshgrid(A,A)\n",
      "\n",
      "for z in B:\n",
      "    X,Y = A1,A2\n",
      "    Z = fn(X,Y,z)\n",
      "    cset = ax.contour(X, Y, Z+z, [z], zdir='z',colors='r')\n",
      "\n",
      "for y in B:\n",
      "    X,Z = A1,A2\n",
      "    Y = fn(X,y,Z)\n",
      "    cset = ax.contour(X, Y+y, Z, [y], zdir='y',colors='b')\n",
      "\n",
      "for x in B:\n",
      "    Y,Z = A1,A2\n",
      "    X = fn(x,Y,Z)\n",
      "    cset = ax.contour(X+x, Y, Z, [x], zdir='x',colors='g')\n",
      "\n",
      "ax.set_zlim3d(zmin,zmax)\n",
      "ax.set_xlim3d(xmin,xmax)\n",
      "ax.set_ylim3d(ymin,ymax)\n",
      "\n",
      "plt.show()"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [],
     "prompt_number": 4
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "import numpy as np\n",
      "import matplotlib.pyplot as plt\n",
      "\n",
      "r = np.arange(0, 3.0, 0.01)\n",
      "theta = 2 * np.pi * r\n",
      "ax = plt.subplot(111, polar=True)\n",
      "ax.grid(False)\n",
      "# ax.set_title(\"r=a(1-sin\u03b8)\")\n",
      "# ax.plot(theta, 1 - np.sin(theta), color='r', linewidth=2)\n",
      "plt.fill(theta, (1 - np.sin(theta)), 'r', lw=1)  # Fill the heart.\n",
      "plt.show()"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [],
     "prompt_number": 6
    },
    {
     "cell_type": "code",
     "collapsed": true,
     "input": [],
     "language": "python",
     "metadata": {},
     "outputs": [],
     "prompt_number": 3
    }
   ],
   "metadata": {}
  }
 ]
}